package foo;

import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TBinaryProtocol.Factory;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TServerSocket;



import foo.UserStorage.Processor;

public class Server {
	static private void start() {
		try {
			TServerSocket serverTransport = new TServerSocket(7777);
			UserStorage.Processor  processor = new UserStorage.Processor(new UserStorageImpl());
			Factory protFactory = new TBinaryProtocol.Factory(true, true);
			
			TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor)   );
			System.out.println("Server start on port:" + 7777);
			server.serve();
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		start();
	}
}
